/**
 * 
 */
package org.braketester.model.filters;

import java.util.LinkedList;

import org.braketester.model.containering.Containering;

/**
 * @author LAP
 *
 */
public class RunnableContaineringFilter extends RunnableFilter {
	private Containering containering;
	private LinkedList<Double> containeredList;
	private Thread filterThread;
	
	public RunnableContaineringFilter(Containering containering) {
		super();
		if (containering == null) throw new IllegalArgumentException("data or containerin is null");
		this.containering = containering;
		filterThread = new Thread(this);
	}
	
	@Override
	protected Double doFilter(Double value) {
		Double ret = containering.convertVoltageByContainering(value);
		containeredList.add(ret);
		return ret;
	}
	
	@Override
	public void start() {
		filterThread.start();
	}
	
	public LinkedList<Double> getContaineredList() {
		return containeredList;
	}
}
